$(function () {
    getkeywork()
})
function find() {
    let keywork = $('[name=keywork]').val()
    getkeywork(keywork);
}
function getkeywork(keywork) {
    keywork=keywork||''
    console.log(keywork);
    getlist(keywork).then(res=>{
        console.log(res);
    route(res.data)
    })
}
function route(data) {
    let tb=$('#tb')
    let tr=$('.tr')
    tr.remove()
    data.forEach(item => {
        let html=`
        <tr class="tr" key="id=${item.id}">
            <td>${item.id}</td>
            <td>${item.biaoti}</td>
            <td>${item.zhaiyao}</td>
            <td>${item.text}</td>
            <td>${item.type}</td>
            <td>${item.author}</td>
            <td>${item.createdAt}</td>
            <td>
            <input type="button" value="修改" onclick="edit(${item.id})">
            <input type="button" value="删除" onclick="deleted(${item.id})">
        </td>
        </tr>
        `
        tb.append(html)
        
    });
}